import { createRouter, createWebHistory } from 'vue-router';
import Sidebar from '../layouts/Sidebar.vue';
import ParentLayout from "../layouts/ParentLayout.vue";
import Login from "../views/login/Login.vue";
import Home from "../views/overview/home.vue";
import HealthList from "../views/health/list.vue";
import TaskList from "../views/task/list.vue";
import Diagnose from "../views/diagnose/diagnose.vue";
import Warning from "../views/diagnose/warning.vue";
import HealthDetail from "../views/health/healthDetail.vue";
import NewTask from "../views/task/newtask.vue";
import Result from "../views/task/result.vue";
import ThreeDModelLibrary from "../views/3d-visualization/ThreeDModelLibrary.vue";
import VehicleVisualization from "../views/3d-visualization/VehicleVisualization.vue";
import AlgorithmModelList from "../views/algorithm-management/AlgorithmModelList.vue";
import ModelTrainingDeploy from "../views/algorithm-management/ModelTrainingDeploy.vue";
import RuleEngineManagement from "../views/algorithm-management/RuleEngineManagement.vue";
import RAGKnowledgeBase from "../views/algorithm-management/RAGKnowledgeBase.vue";
import ReportGeneration from "../views/report-center/ReportGeneration.vue";
import ReportViewing from "../views/report-center/ReportViewing.vue";


const routes = [
  {
    path: '/',
    redirect: '/login' // 根路径重定向到「登录页」
  },
  {
    path: '/login',
    name: 'Login',
    component: Login // 登录页组件
  },
  {
    path: '/sidebar',
    name: 'Sidebar',
    component: Sidebar,
  },

  {
    path: '/overview',
    redirect: '/overview/home',
    component: ParentLayout,
    children: [
      { path: 'home', component: Home },
    ]
  },
  {
    path: '/diagnose',
    redirect: '/diagnose/diagnose',
    component: ParentLayout,
    children: [
      { path: 'diagnose', component: Diagnose },
      { path: 'warning', component: Warning }
    ]
  },
  {
    path: '/health',
    redirect: '/health/detail',
    component: ParentLayout,
    children: [
      { path: 'detail', component: HealthDetail },
      { path: 'list', component: HealthList }
    ]
  },
  {
    path: '/task',
    redirect: '/task/list',
    component: ParentLayout,
    children: [
      { path: 'list', component: TaskList },
      { path: 'newtask', component: NewTask },
      { path: 'result', component: Result }
    ]
  },
  // 三维可视化模块
  {
    path: '/3d-visualization',
    redirect: '/3d-visualization/model-library',
    component: ParentLayout,
    children: [
      { path: 'model-library', component: ThreeDModelLibrary },
      { path: 'vehicle/:id?', component: VehicleVisualization }
    ]
  },

  // 算法库管理模块
  {
    path: '/algorithm-management',
    redirect: '/algorithm-management/model-list',
    component: ParentLayout,
    children: [
      { path: 'model-list', component: AlgorithmModelList },
      { path: 'training-deploy', component: ModelTrainingDeploy },
      { path: 'rule-engine', component: RuleEngineManagement },
      { path: 'knowledge-base', component: RAGKnowledgeBase }
    ]
  },

  // 报表中心模块
  {
    path: '/report-center',
    redirect: '/report-center/generation',
    component: ParentLayout,
    children: [
      { path: 'generation', component: ReportGeneration },
      { path: 'viewing', component: ReportViewing }
    ]
  },


];

const router = createRouter({
  history: createWebHistory('/'),
  routes,
});

export default router;